Mega Code Archive

Categories
1) Android
2) ASP.Net
3) ASP.Net Tutorial
4) C
5) C Tutorial
6) C#
7) C# Book
8) C# by API
9) C# Tutorial
10) C++
11) C++ Tutorial
12) Delphi
13) Flash ActionScript
14) Flex
15) Java
16) Java Book
17) Java by API
18) Java Tutorial
19) JavaScript DHTML
20) JavaScript Reference
21) JavaScript Tutorial
22) MSOfficeExcel 2007 Tutorial
23) MSOfficePowerPoint 2007 Tutorial
24) MSOfficeWord 2007 Tutorial
25) MSSQL
26) MSSQL Tutorial
27) MySQL
28) MySQL Tutorial
29) Oracle PLSQL
30) Oracle PLSQL Tutorial
31) Perl
32) Php
33) PostgreSQL
34) Python
35) Python Tutorial
36) Ruby
37) Silverlight
38) VB.Net
39) VB.Net by API
40) VB.Net Tutorial
41) Visual C++ .NET
42) VisualBasic Script
43) XML
44) XML Tutorial
 
C#
1) 2D Graphics
2) ADO Database
3) Class Interface
4) Collections Data Structure
5) Components
6) Data Types
7) Date Time
8) Design Patterns
9) Development Class
10) Event
11) File Stream
12) Generics
13) GUI Windows Form
14) Internationalization
15) Language Basics
16) LINQ
17) Network
18) Office
19) Reflection
20) Regular Expressions
21) Security
22) Services Event
23) Thread
24) Web Services
25) Windows
26) WPF
27) XML
28) XML LINQ
Language Basics
1) #define, #if, and #endif preprocessor directives
2) #undef Marco
3) #undef, #elif, and #else preprocessor directives
4) A class receives the notification when a static method is used as an event handler
5) A class that displays the binary representation of a value
6) A do while loop
7) A for loop to display 1 to 5
8) A foreach loop
9) A negatively running for loop
10) A promotion surprise
11) A simple attribute example
12) A simple delegate example
13) A very simple event demonstration
14) Accessing Structure Members with a Pointer
15) Add Assigment for both number and string value
16) Address and size of pointer object
17) Allocates 26 characters on the stack the for loop assigns alphabetic characters to each element
18) Allocating Memory from the Stack
19) An array name with an index yields a pointer to the start of the array
20) An attempt to reference an uninitialized variable
21) An event multicast demonstration
22) An exception can be generated by one method and caught by another
23) And Assignment
24) Anonymous methods can be assigned a signature
25) Anonymous methods can be assigned a signature, which is appended to the delegate keyword
26) Anonymous methods can refer to local variables of the containing function and class members within the scope of the method
27) Another if else
28) ArrayList foreach
29) Arrays as Function Returns and Parameters
30) Arrays of Delegates
31) As operator
32) Associating the delegate with an anonymous method
33) Async Delegate Invocation
34) Async Delegates Callback
35) Attribute in class inheritance
36) Bit and, or, xor, not operator
37) Bit move operator
38) Bit operator
39) Bit Operators
40) Bit Shift operator
41) Bitwise operation
42) Bitwise Operators 2
43) C# Namespaces and Using
44) C# Ref and Out Parameters
45) Calling Native DLL Functions
46) Calls GetBaseException and outputs the error message of the initial exception
47) Catch Block With Exception Object
48) Catch different exceptions
49) Catch Divide By Zero Exception
50) Catch Error
51) Catch StackOverflowException for recursive function
52) Catch without Exception type
53) Catches an exception that was thrown in a component
54) Chaining events
55) Check size with sizeof operator
56) Check the array length for params parameters
57) Choose between two overloaded methods at run-time using the is keyword
58) Class level Variable scope
59) Combining delegates Multiple delegates are combined using the Combine method, the plus operator (+), or the += assignment
60) Compare pointer
61) Compare the difference between passing a null reference vs a reference to a zero length string
62) Compiles into a library defining the RamdomSupplier attribute and the RandomMethod attribute
63) Compute integer powers of 2
64) Compute the order of magnitude of an integer
65) Compute the sum and product of the numbers from 1 to 10
66) Conditional operator and Math calculation
67) Continue in while
68) Control the operator evaluation sequence
69) Create a 4-bit type called Nybble
70) Create a custom means of managing the event invocation list
71) Create an implication operator in C#
72) CreateDelegate and DynamicInvoke
73) Creates a library assembly
74) Creates instances of a value and a reference type
75) Creating an alias
76) Creating and using a class attribute
77) Deal with the arguments
78) Declare loop control variable inside the for
79) Declaring a reference type variable and creating an object the variable will reference
80) Declaring a variable
81) Define an alias to represent a namespace
82) Define an anonymous method with the delegate keyword
83) Define contant and use it in Conditional attribute
84) Define function
85) Define your own delegate
86) Defining New Attribute Classes
87) Definite Assignment and Arrays
88) Delegate and event hierarchy
89) Delegate BeginInvoke of IAsyncResult
90) Delegates
91) Delegates And Events
92) Delegates And Events 2
93) Delegates can refer to instance methods, too
94) Delegates to Instance Members
95) Demonstates the possible uses of a finally block
96) Demonstrate #elif
97) Demonstrate #else
98) Demonstrate #if, #endif, and #define
99) Demonstrate a block of code
100) Demonstrate a namespace
101) Demonstrate a namespace 2
102) Demonstrate a using alias
103) Demonstrate an @ identier
104) Demonstrate as
105) Demonstrate block scope
106) Demonstrate casting
107) Demonstrate dynamic initialization
108) Demonstrate exception handling
109) Demonstrate fixed
110) Demonstrate getting and printing the invocation list for a delegate
111) Demonstrate is
112) Demonstrate lifetime of a variable
113) Demonstrate params
114) Demonstrate passing an object to an event handler and performing the proper cast in the method
115) Demonstrate pointer comparison
116) Demonstrate pointers and unsafe
117) Demonstrate the % operator
118) Demonstrate the bitwise NOT
119) Demonstrate the Conditional attribute
120) Demonstrate the difference between prefix postfix forms of ++
121) Demonstrate the effects of pointer arithmethic
122) Demonstrate the for loop
123) Demonstrate the goto
124) Demonstrate the if
125) Demonstrate the Obsolete attribute
126) Demonstrate the relational and logical operators
127) Demonstrate the shift operators
128) Demonstrate the short-circuit operators
129) Demonstrate the switch
130) Demonstrate the use of readonly variables
131) Demonstrate using a static delegate without declaring an instance of the class
132) Demonstrate using statement
133) Demonstrates a simple form of a delegate
134) Demonstrates adding multiple methods to a delegate
135) Demonstrates combining and removing delegates to create new delegates
136) Demonstrates compound assignment operators
137) Demonstrates defining and using a custom exception class
138) Demonstrates rethrowing an exception from a method
139) Demonstrates stacking catch blocks to provide alternate code for more than one exception type
140) Demonstrates the flags attribute of an enumeration
141) Demonstrates the use of a conditional method
142) Demonstrates the use of Environment Exit() in a command line program
143) Demonstrates using as a statement
144) Demonstrates using if statements to sort out an IOException
145) Demonstrating StringBuilder AppendFormat
146) Derived exceptions must appear before base class exceptions
147) Determine if a number is prime If it is not, then display its largest factor
148) Determine if a value is positive or negative
149) Determine if a value is positive, negative, or zero
150) Determine smallest single-digit factor
151) Display the bits within a byte
152) Display the digits of an integer in reverse order
153) Do While Tester
154) Empty cases can fall through
155) Equals and ReferenceEquals
156) Events
157) Every console app starts with Main
158) Example of using the fixed statement
159) Exception handle with finally
160) Exception handle with your own exception class
161) Exception Handling
162) Exception Handling Finally
163) Exception Handling User-Defined Exception Classes
164) Exception throw and catch
165) Exception throw and catch 2
166) Exception throws
167) Exception Translation
168) Exception Type Mismatch
169) Exception with finally
170) Expressions 1
171) Expressions to calculate and display the circumference of a circle
172) File to be used as a library assembly
173) File to be used as a library assembly 2
174) Find the smallest factor of a value
175) Fixing Managed Data in Memory
176) For loop for array
177) For Loop Tester
178) For with empty condition
179) For without increase
180) For without init value
181) Foreach for arraylist
182) Format Error String
183) Get Most Inner Exception
184) Get variable address in unsafe mode
185) Gets the details of an exception suitable for display
186) Goto Tester
187) Handle error gracefully and continue
188) Hashtable and foreach
189) Heap and Stack Memory
190) How the using statement is used to specify namespaces
191) create a custom attribute
192) If Branching
193) If Else
194) If else for int
195) If inside a for
196) Iff operator in C#
197) Illustrates a custom exception
198) Illustrates a nested trycatch block
199) Illustrates a try, catch, and finally block
200) Illustrates an unhandled exception
201) Illustrates creating and throwing an exception object
202) Illustrates exception propagation with methods
203) Illustrates how to handle a specific exception
204) Illustrates multiple catch blocks
205) Illustrates the GetCustomAttributes method
206) Illustrates the use of a const field
207) Illustrates the use of a delegate 2
208) Illustrates the use of a delegate that calls object methods
209) Illustrates the use of a multicast delegate
210) Illustrates the use of a nested if statement
211) Illustrates the use of a System Exception object
212) Illustrates the use of an event
213) Illustrates the use of an if statement that executes a block
214) Illustrates the use of comments
215) Illustrates the use of constants
216) Illustrates the use of out parameters
217) Illustrates the use of StringBuilder objects
218) Illustrates the use of the arithmetic operators
219) Illustrates the use of the bitwise operators
220) Illustrates the use of the Boolean logical operators
221) Illustrates the use of the comparison operators
222) Illustrates the use of the if statement
223) Illustrates the use of the is operator
224) Illustrates the use of the shortcut operators
225) Illustrates the use of the switch statement
226) Illustrates the use of the switch statement to compare string values
227) Illustrates the use of the ternary operator
228) Illustrates the use of two namespaces
229) Illustrates use of the Conditional attribute
230) Illustrates use of the Obsolete attribute
231) Illustrates variable scope
232) Index a pointer as if it were an array
233) Individual objects receive notifications when instance event handlers are used
234) Init variable
235) Initializing a variable
236) Int pointer variable
237) Int, float, double, decimal
238) Intentionally throws an error to demonstrate Just-In-Time debugging
239) Interfaces
240) Invalid Cast Exceptions with Implicit Operators
241) Is Checker
242) Late Binding Delegates
243) Let the C# runtime system handle the error
244) Lifetime of outer variables is aligned with the delegate
245) Line number
246) Loading Assemblies
247) Local variables used in an anonymous method are called outer variables
248) Logical and and bitwise and
249) Logical exclusive-or
250) Logical operators with an if statement
251) Logical or and bitwise or
252) Loop condition can be any bool expression
253) Loop with letter char as the control variable
254) Main Function
255) Manually throw an exception
256) Mark method as unsafe
257) Math Operators with int value
258) Method scope variable
259) Mod test
260) Move more out of the for loop
261) Multiple Indirect
262) Namespaces are additive
263) Namespaces can be nested
264) Namespaces prevent name conflicts
265) Normal parameter and params parameters
266) Null pointer
267) Numeric Operators 1
268) Numeric Operators 3
269) Object pointer
270) Objects are passed by reference
271) Objects can be passed to methods
272) Operator precedence
273) Operators and Expressions
274) Or Assignment
275) Parameter demo
276) Parameter out and reference
277) Params Array
278) Parts of the for can be empty
279) Pass integer by reference
280) Pass value by reference
281) Pass value by reference with read only value
282) Pass valuel by pointer
283) Passing Exceptions on to the Caller
284) Passing parameters by reference
285) Passing parameters by value
286) Passing Parameters By Value and By Ref
287) Passing parameters to methods
288) Pointer for struct
289) Pointers and Declarative Pinning
290) Precompile marco
291) Prefix and postfix versions of the increment and decrement operators
292) Preprocessor 2
293) Prevent a division by zero using the 1
294) Print the stack trace when an exception is thrown
295) Printing the stack trace from the Environment when an exception is not thrown
296) Provides a simple example of function overloading
297) Queue enqueue and foreach
298) Recursive Factorial method
299) Recursive function in action
300) Recursive sum method
301) Ref and Out Parameters
302) Ref and Out Parameters 2
303) Ref pointer parameter
304) Reference, output and value parameters
305) References and Pointers
306) Refines the System Exception base class with name of the type and time of exception to create your own Exception
307) Relational Operators
308) Relational Operators 3
309) Replace()
310) Rethrow an exception
311) Return different value to the operating system based on the argument length
312) Returns the simple name of the class, for use in exception messages
313) Scope class demonstrates instance and local variable scopes
314) Scoping in C#
315) Search an array using foreach
316) Self decrease
317) Self increment
318) Several catch branches
319) Shift Operators 2
320) Show bits
321) Shows how multiple objects may subscribe to the same event
322) Shows the use of assembly attributes
323) Side-effects can be important
324) Simple types are passed by value
325) Simplest do while
326) Simplest for
327) Simplest while
328) Simulate a conveyor belt
329) Stack push and foreach
330) Stackalloc Demo
331) Static Main function
332) StringBuffer
333) StringBuilder
334) StringBuilder append
335) StringBuilder AppendFormat() method to add a formatted string containing a floating point number to myStringBuilder
336) StringBuilder EnsureCapacity method
337) StringBuilder foreach
338) StringBuilder Insert()
339) StringBuilders properties for different constructors
340) Subclass System Attribute
341) Sums the values in an array using a foreach loop
342) Supported sizeof() Types
343) Swap two references
344) Swap two values
345) Switch based console menu
346) Switch for int type
347) Switch statement containing a branch with no statements
348) Switch Values
349) Switch Values Fall Through
350) Switch With Default Values
351) System maximums and minimums
352) Ternary operator
353) Test is and as
354) Testing the effects of passing array references by value and by reference
355) The @ prefix turns off the processing of escape characters
356) The + Operator Is Left Associative
357) The body of a loop can be empty
358) The break statement
359) The continue statement
360) The finished C# statement Help system that processes multiple requests
361) The goto statement
362) The Hello World! Application with XML Comments
363) The is operator confirms that the employee is a manager
364) The Main Function
365) The minimum implementation of a delegate
366) The out descriptor allows a function a value in an argument without initializing the argument
367) The publishersubscriber relationship is a one-to-many relationship
368) The syntax of the GetInvocationList method
369) The use of namespace hierarchies (part 1)
370) This is a simple C# program
371) This program attempts to declared a variable in an inner scope
372) This version does not include the using System statement
373) Throw a format exception purposely to demonstrate catching a FormatException
374) Throw and catch Exception
375) Throw exception from getter
376) Throwing Your Own Exceptions
377) To remove delegates from a multicast delegate, use the Remove method, the minus operator (-), or the -= assignment operato
378) ToString()
379) Try and catch exception
380) Try catch with finally
381) Two delegates
382) Two delegates and anonymous methods
383) Two reference type variables may refer (or point) to the same object
384) Uninitialized Values
385) Unsafe and fixed block
386) Unsafe code
387) Unsafe Context
388) Unsafe Methods
389) Update two parameters in for loop
390) Use a char to control the switch
391) Use a custom Exception for RangeArray errors
392) Use a named attribute parameter
393) Use a nested try block
394) Use a property as a named attribute parameter
395) Use a recursive method, travel, to journey from start to finish
396) Use a symbol expression
397) Use AttributeUsage
398) Use bitwise AND to determine if a number is odd
399) Use bitwise AND to make a number even
400) Use bitwise OR to make a number odd
401) Use break with a foreach
402) Use commas in a for statememt
403) Use commas in a for statememt to find the largest and smallest factor of a number
404) Use continue
405) Use delegate
406) Use final to deal with custom Exceptions
407) Use finally
408) Use fixed to get a pointer to the start of a string
409) Use foreach on a two-dimensional array
410) Use goto with a switch
411) Use internal
412) Use is to avoid an invalid cast
413) Use marco to define flag variable
414) Use multiple catch statements
415) Use new with a value type
416) Use out
417) Use out to mark an object parameter
418) Use params to mark parameter
419) Use ref to mark an object parameter
420) Use ref to pass a value type by reference
421) Use regular parameter with a params parameter
422) Use stackalloc to allocate memory for integer array
423) Use the bult-in EventHandler delegate
424) Use the catch all catch statement
425) Use the foreach loop
426) Use the NullReferenceException
427) Use the params feature to write functions which accept a variable number of arguments
428) Use the Remove() method to remove part of StringBuilder
429) Use the shift operators to multiply and divide by 2
430) Use two out parameters
431) Use unsafe method to clone array
432) Use unsage code to swap two integers
433) Use XOR to encode and decode a message
434) Uses some of the properties of the Exception class
435) Using a delegate with a container class to sort the collection and return a sorted array using different sort criteria
436) Using an alias to resolve ambiguity
437) Using break to exit a do-while loop
438) Using break to exit a loop
439) Using break with nested loops
440) Using casts in an expression
441) Using checked and unchecked
442) Using checked and unchecked with statement blocks
443) Using command-line arguments to initialize an array
444) Using Exception members
445) Using namespace
446) Using the alias keyword to refer to a nested namespace
447) Using the as Keyword to Work with an Interface
448) Using the is Keyword to Work with an Interface
449) Using the unsafe keyword
450) Variable default name
451) Variable Scoping and Definite Assignment
452) Variations on the Main() Method
453) What happens if an unhandled exception is raised in a multicast delegate
454) While loop to calculate and display the Fibonacci numbers less than 50
455) While loop to display 1 to 5
456) While Signal
457) While Tester
458) While true test
459) White space is preserved with verbatim strings
460) You must declare that code that uses the sizeof operator as unsafe